package com.milepost.messagepush.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author huarf
 * @Description
 * @create 2021-08-31 18:24
 */
@Configuration
public class FilterConfig {

    /**
     * 注册 RequiredParamFilter
     * @return
     */
    @Bean
    public FilterRegistrationBean<SessionFilter> requiredParamFilter() {
        FilterRegistrationBean<SessionFilter> bean = new FilterRegistrationBean<SessionFilter>();
        bean.setFilter(new SessionFilter());
        bean.setName("sessionFilter");
        //拦截所有请求
        bean.addUrlPatterns("/*");
        bean.setOrder(1);
        return bean;
    }
}
